<extend name="Public/layout" />

<block name="body">
    <!-- 数据列表 -->
    <div class="data-table">
        <table class="table table-hover">
            <thead>
                <tr>
                    <th>名称</th>
                    <th>标识</th>
                    <th >描述</th>
                    <th>状态</th>
                    <th>作者</th>
                    <th>版本</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                <volist name="volist" id="vo">
                    <tr>
                        <td>{$vo.title}</td>
                        <td>{$vo.name}</td>
                        <td>{$vo.description}</td>
                        <td>{$vo.status_text|default="未安装"}</td>
                        <td><a target="_blank" href="http://www.corethink.cn">{$vo.author}</a></td>
                        <td>{$vo.version}</td>
                        <td>
                            <empty name="vo.uninstall">
                                <?php
                                    $class = get_addon_class($vo['name']);
                                    if(!class_exists($class)){
                                        $has_config = 0;
                                    }else{
                                        $addon = new $class();
                                        $has_config = count($addon->getConfig());
                                    }
                                ?>
                                <?php if($has_config): ?>
                                    <a href="{:U('config',array('id'=>$vo['id']))}">设置</a>
                                <?php endif ?>
                                <?php if($vo['adminlist']): ?>
                                    <a href="{:U('adminlist',array('name'=>$vo['name']))}">数据</a>
                                <?php endif ?>
                                <eq name="vo.status" value="0">
                                    <a class="ajax-get" href="{:U('setStatus',array('status'=>'resume', 'ids' => $vo['id']))}">启用</a>
                                <else />
                                    <a class="ajax-get" href="{:U('setStatus',array('status'=>'forbid', 'ids' => $vo['id']))}">禁用</a>
                                </eq>
                                <eq name="vo.author" value="CoreThink">
                                    <a class="ajax-get" href="{:U('uninstall?id='.$vo['id'])}">卸载</a>
                                </eq>
                            <else />
                                <a class="ajax-get" href="{:U('install?addon_name='.$vo['name'])}">安装</a>
                            </empty>
                        </td>
                    </tr>
                </volist>
            </tbody>
        </table>
        <ul class="pager pager-loose pager-pills">{$page}</ul>
    </div>
</block>
